﻿using PlutoStudio.Configuration;
using PlutoStudio;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.Composition;

namespace Plutostudio.Configuration.Test
{
    class Program
    {
        static  void Main(string[] args)
        {
            MefContainer.SetService("Name", "李四");
            //MefContainer.Register<Config>().ImportProperties<string>(s=>s.Name=="Name",(s,p)=>p.AsContractName("Name"));
            Console.WriteLine(Configuration<Config>.GetValue().Name);

            //var client =  PlutoStudio.Net.Http.HttpClient.Create("http://www.baidu.com").Parameter(new { query = "test", word = "qa" }).Content(new { query = "test", word = "qa" }, PlutoStudio.Net.Http.ContentType.Json).PostStringAsync();
        }
    }

    public class Config
    {
        public string Name { get; set; }
    }

    [ConfigProvider(typeof(Config))]
    public class ConfigProvider :IConfigurationProvider<Config>
    {
        public Config GetConfig()
        {
            return new Config { Name = "李四" };
        }
    }
}
